<?php

class category_m extends CI_Model {

	public function __construct() {
		parent::__construct();
		$this->load->database();
	}

	public function getIdBySlug($slug)
	{
		$sql = "SELECT * FROM category WHERE status = 0";
		if($slug != '')
		{
			$sql .= " AND `slug` LIKE '%$slug%'";
		}
		$query = $this->db->query($sql);
		return $query->row();
	}

	public function getItem($id)
	{
		$sql = "SELECT * FROM category WHERE status = 0";
		if($id != 0)
		{
			$sql .= " AND id = $id";
		}
		$query = $this->db->query($sql);
		return $query->row();
	}

}